package com.overoid.diary.ui;


import java.util.ArrayList;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.TextView;
import android.content.Context;

import com.overoid.diary.R;
import com.overoid.diary.ui.common.ListActivityImpl;

public class DaysActivity extends ListActivityImpl {


	@Override
	protected void onCreate(Bundle savedInstanceState) {
			/*
		super.onCreate(savedInstanceState);	
		
		//setContentView(R.layout.days);
		
		ArrayList<DaysItem> itemList = new ArrayList<DaysItem>();

		DaysItem item01 = new DaysItem(); 
		DaysItem item02 = new DaysItem(); 
		DaysItem item03 = new DaysItem();
		
		item01.setDayFeelingIcon("icon");
		item01.setDate("3.5");
		item01.setDayContents("conteentsssssssssssssssssssssssssssssssssssssssssssssssss");
		item01.setPicCnt("10");
		item01.setAlarmCnt("20");
		item01.setMovieCnt("30");
		
		item02.setDayFeelingIcon("icon");
		item02.setDate("3.6");
		item02.setDayContents("conteents");
		item02.setPicCnt("10");
		item02.setAlarmCnt("20");
		item02.setMovieCnt("30");
		
		item03.setDayFeelingIcon("icon");
		item03.setDate("3.7");
		item03.setDayContents("conteents");
		item03.setPicCnt("10");
		item03.setAlarmCnt("20");
		item03.setMovieCnt("30");
		
		itemList.add(item01);
		itemList.add(item02);
		itemList.add(item03);

		DayArrayAdapter adapter = new DayArrayAdapter(this, R.layout.days_list_item,itemList); 
		setListAdapter(adapter);
		
		
		
		//Intent it = getIntent();
		
		
		
		final Button dayCancle =  (Button)findViewById(R.id.daysBtnCancle);
		dayCancle.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
				//Intent i = new Intent();
				//ComponentName comp = new ComponentName("com.ex.Browser", "com.ex.Browser.Setting"); // com.ex.Browser.BrowserView
				//i.setComponent(comp);
				// TODO Auto-generated method stub
				
				//Intent in = getIntent();//new Intent(DaysActivity.this,HomeActivity.class);
				
				//startActivity(in);
				//Toast.makeText(,"btn cancle",Toast.LENGTH_SHORT)
				
			}
		});
		
		
	}

	private class DayArrayAdapter extends ArrayAdapter<DaysItem> {

		private ArrayList<DaysItem> items;

		public DayArrayAdapter(Context context, int textViewResourceId, ArrayList<DaysItem> items) {
			super(context, textViewResourceId, items);
			this.items = items;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			View v = convertView;
			if (v == null) {
				LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
				v = vi.inflate(R.layout.days_list_item, null);
			}
			
			DaysItem daysItem = items.get(position);
			
			if(daysItem != null){
				TextView icon = (TextView)v.findViewById(R.id.daysTxtFeelingIcon);
				icon.setText(daysItem.getDayFeelingIcon());
				
				TextView date = (TextView)v.findViewById(R.id.daysTxtDate);
				date.setText(daysItem.getDate());
				
				TextView cont = (TextView)v.findViewById(R.id.daysTxtContents);
				cont.setText(daysItem.getDayContents());
				
				TextView pic = (TextView)v.findViewById(R.id.daysTxtPicCnt);
				pic.setText("pic("+daysItem.getPicCnt()+")");
				
				TextView al = (TextView)v.findViewById(R.id.daysTxtAlarmCnt);
				al.setText("alram("+daysItem.getAlarmCnt()+")");
				
				TextView mv = (TextView)v.findViewById(R.id.daysTxtMovieCnt);
				mv.setText("movie("+daysItem.getMovieCnt()+")");
			}

			return v;
		}
	}

	class DaysItem {

		private String dayFeelingIcon;	
		private String date;
		private String dayContents;
		private String picCnt;
		private String alarmCnt;
		private String movieCnt;
		
		public String getDayFeelingIcon() {
			return dayFeelingIcon;
		}
		public void setDayFeelingIcon(String dayFeelingIcon) {
			this.dayFeelingIcon = dayFeelingIcon;
		}
		public String getDate() {
			return date;
		}
		public void setDate(String date) {
			this.date = date;
		}
		public String getDayContents() {
			return dayContents;
		}
		public void setDayContents(String dayContents) {
			this.dayContents = dayContents;
		}
		public String getPicCnt() {
			return picCnt;
		}
		public void setPicCnt(String picCnt) {
			this.picCnt = picCnt;
		}
		public String getAlarmCnt() {
			return alarmCnt;
		}
		public void setAlarmCnt(String alarmCnt) {
			this.alarmCnt = alarmCnt;
		}
		public String getMovieCnt() {
			return movieCnt;
		}
		public void setMovieCnt(String movieCnt) {
			this.movieCnt = movieCnt;
		}

		*/
	}
}

